package org.xiaoxin.onecoupon.settlement.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.xiaoxin.onecoupon.framework.result.Result;
import org.xiaoxin.onecoupon.framework.web.Results;
import org.xiaoxin.onecoupon.settlement.dto.req.QueryCouponsReqDTO;
import org.xiaoxin.onecoupon.settlement.dto.resp.QueryCouponsRespDTO;
import org.xiaoxin.onecoupon.settlement.service.CouponQueryService;

/**
 * @author xiaoxin
 * 查询用户优惠券控制层
 * 2025/5/15
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "查询用户优惠券管理")
public class CouponQueryController {
   private final CouponQueryService couponQueryService;
   @Operation(summary = "查询用户可用/不可用优惠券列表")
   @PostMapping("/api/settlement/coupon-query")
   public Result<QueryCouponsRespDTO> listQueryCoupons(@RequestBody QueryCouponsReqDTO requestParam) {
      return Results.success(couponQueryService.listQueryUserCoupons(requestParam));
   }
   @Operation(summary = "查询用户可用/不可用优惠券列表")
   @PostMapping("/api/settlement/coupon-query-thread")
   public Result<QueryCouponsRespDTO> listQueryCouponsByThread(@RequestBody QueryCouponsReqDTO requestParam) {
      return Results.success(couponQueryService.listQueryUserCouponsByThread(requestParam));
   }
}
